'''
__getattr__ 获取成员变量时触发
__setattr__ 设置...........
__delatrr__ 监控删除...........
'''
class FangKuai:
    def __init__(self):
        self.width=0
        self.height=0
        self.left=0
        self.top=0
    def __setattr__(self, key, value):
        print('设置属性被处发')
        if(key=='size'):
            self.width,self.height=value#返回列表或元祖
        elif(key=='position'):
            self.left,self.top=value
        else:
            self.__dict__[key]=value#默认保存在内部

    def __getattr__(self, item):
        print('获取属性被处发')
        if(item=='size'):
            return self.width,self.height
        elif(item=='position'):
            return self.left,self.top
    def __delattr__(self, item):
        print('删除属性被处发')
        if(key=='size'):
            self.width=0
            self.height=0
        elif(key=='position'):
            self.left=0
            self.top=0

fk=FangKuai()
fk.size=(100,200)
# fk.position=(50,60)
#
# print('查看size',fk.size)
# print('查看position',fk.position)